/**
 * Created by root on 2017/8/1.
 * 返回主页面的最新笔记
 * 返回当前用户名
 */
window.onLoad=function(){
    var mytitle=document.getElementsByTagName("article")[0].firstChild;
    var mydate=document.getElementById("date");
    var mytext=document.getElementsByTagName("article")[0].lastChild;
    var edit_button=document.getElementsByClassName("control_list")[0];


    var request=new XMLHttpRequest();
    request.open("POST","",true);
    //var data=
    request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    request.send();
    request.onreadystatechange=function(){
        if(request.readyState==4)
        {
            if(request.status==200)
            {
                var data=JSON.parse(request.responseText);
                //检测
                if(数据返回成功)
                {
                    mytitle.innerHTML=;
                    mydate.innerHTML=;
                    mytext.innerHTMl=;
                }


            }
            else
            {
                alert("发送错误"+request.status);
            }
        }
    }

    edit_button.onclick=function(){
        var request2=new XMLHttpRequest();
        request2.open=("POST","",true);
        var data=""+mytitle.innerHTML;          //返回json字段d具体值
        request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        request2.send(data);
        request2.onreadystatechange=function(){
         if(request2.readyState==4)
         {
             if(request2.status==200)
             {
                 //如果成功发送，就进入编辑页面
             }
             else
             {
                 alert("发送错误"+request2.status);
             }
         }
        }
    }


}